package xmlMapping;

import xmlMapping.model.Computer;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

import java.util.List;

public class MainComputer {
    public static void main(String[] args) {
        Configuration cfg = new Configuration();

        SessionFactory sf = cfg.configure().buildSessionFactory();
        Session session = sf.openSession();
        try {
            List<Computer> list = session.createCriteria(Computer.class).list();
            list.forEach(i -> System.out.println(i));
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            session.close();
        }
    }
}
